<?

	$_SESSION['url'] = getURL();
	$act = $_GET['act'];
	//HOME TOP LINK TO BACK
	$rid = intval($_GET['rid']);
	if(!isset($rid)){reHome($urlHome);}
	//
	
	$rs = $db->query("SELECT * FROM ".$prefix."raovat WHERE rv_id = '".$rid."' AND rv_hienthi = 1");
	$row = $db->fetch_array($rs);
	if($db->num_rows($rs) == 0){ reHome($urlHome);}
	//
	$cid = $row[rv_loairaovat];
	$HomeLink = "<div><a href=\"".$root."/trang-chu/\">Trang chủ</a></div>";
	if(isset($cid)){
		$rs = $db->query("SELECT * FROM ".$prefix."loairaovat WHERE rvc_id = '".$cid."' AND rvc_hienthi = 1");
		if($db->num_rows($rs) != 0){
			$row = $db->fetch_array($rs);
				$rvc_id_cha = $row[rvc_id_cha];
				$rvc_name = stripslashes($row[rvc_ten]);
				
				$rs2 = $db->query("SELECT * FROM ".$prefix."loairaovat WHERE rvc_id = '".$rvc_id_cha."' AND rvc_hienthi = 1");
				$row2 = $db->fetch_array($rs2);
				$rvc_id2 = $row2[rvc_id];
				$rvc_name2 = stripslashes($row2[rvc_ten]);
				
				$HomeLink .= "<div><a href=\"".$root."/danh-muc-rao-vat/".$rvc_id2."/".$myString->vietdecode($rvc_name2)."\">".$rvc_name2."</a></div><div><a href=\"".$root."/danh-muc-rao-vat/".$cid."/".$myString->vietdecode($rvc_name)."\">".$rvc_name."</a></div>";
			
		}else{reHome($urlHome);}
	}else{reHome($urlHome);}
	
	$HomeLink .= "<div><a>Chi tiết rao vặt</a></div>";
	
?>
<div class="linkPath">
    <div class="linkPath-text"> 
		<?=$HomeLink?>
        <div style="float: right;">
			<a title="Quay lại trang trước" class="link-back" href="javascript:void(0);" onclick="javascript:history.go(-1);">Quay lại</a>
		</div>
    </div>
</div> 
    <!-- Main Page-Content { -->    
    <div id="page-content">      
        <div id="ctl00_idMainHolder_idProductPanel">

		<?

			////UPDATE SO LAN XEM
				RaoVat_updateSoLanXem($rid);
				
			//UPDATE LAN XEM MOI NHAT
				RaoVat_updateXemGanNhat($rid);
			//
			$rs = $db->query("SELECT * FROM ".$prefix."raovat WHERE rv_id = '".$rid."' AND rv_hienthi = 1");
			$row = $db->fetch_array($rs);
			$rv_id = $row[rv_id];
			$rv_loairaovat = $row[rv_loairaovat];
			$rv_nguoidang = $row[rv_nguoidang];
			$rv_ten_nguoidang = tenNguoiDung($rv_nguoidang);
			$rv_tieude = $myString->unQuote(stripslashes($row[rv_tieude]));
			$rv_anhthehien = $PathThumbFile . $row[rv_anhthehien];
			$rv_mota = $myString->unQuote(stripslashes($row[rv_mota]));
			$rv_quocgia = layQuocGia($row[rv_quocgia]);
			$rv_tinhthanh = layTinhThanh($row[rv_tinhthanh]);
			$rv_ngaydang = format_date($row[rv_thoigian]);
			$rv_thoigiandang = $row[rv_thoigiandang];
			$rv_chitiet = $myString->unQuote(stripslashes($row[rv_chitiet]));
			$rv_solanxem = $row[rv_solanxem];
			$rv_xemgannhat = format_date_time($row[rv_xemgannhat]); 
		?>	
                
		<div id="product-summary">    
			<div class="top">Chi tiết rao vặt</div>            
			<div class="body">     
				<div id="panel-left">
					<div class="content"> 
						<div class="product-picture">
							<p style="text-align:center;vertical-align:middle;margin-left:15px;margin-bottom:10px;">
								<img src="<?=$root?>/<?=$rv_anhthehien?>" alt="<?=$rv_tieude?>" onerror="this.src='<?=$root?>/themes/images/noimg.jpg';"/>
							</p>

						</div> 
						<div class="product-info">
							<h1 class="product-name"><?=$rv_tieude?></h1>
							<p class="product-summary2" style="font-size:8pt;margin-bottom:10px;margin-top:0px;"><?=$rv_mota?>
							</p>
							
								<p><label>Chủng loại:</label> &nbsp;<span class="product-price"><?=tenChungLoaiRaoVat($rv_loairaovat);?></span></p>
								
							<p><label>Khu vực:</label> &nbsp;<?=$rv_tinhthanh?></p> 
							<p><label>Ngày đăng:</label> &nbsp;<span class="product-date"><?=$rv_ngaydang?></span></p>                      
							<div class="product-paymet">                        
								<p style="margin-left:0px; line-height:2;">

									<label style="float:none;margin-left:0px;">Số lần xem:</label>
									&nbsp;<?=$rv_solanxem?>
									<br />
									<label style="float:none;margin-left:0px;">Xem gần nhất:</label>
									&nbsp;<?=$rv_xemgannhat?>
									<br />
									<label style="float:none;margin-left:0px;">Thời gian đăng:</label>
									&nbsp;<?=$rv_thoigiandang?> ngày
								</p>                        
							</div>
						
						</div>           
						<div class="clearBoth" style="margin-top:5px;"></div>             
					</div>     
					   
					<div style="text-align:left;margin-left:10px;width:650px;font-size:10pt;">                
					<?
						if($_SESSION['is_login'] == true && $_SESSION['uid'] == $rv_nguoidang){
					?>
						<a class="link-edit" href="<?=$root?>/sua-tin-rao-vat/<?=$rv_id?>/<?=$myString->vietdecode($rv_tieude)?>">Cập nhật</a>
							|
							<a class="link-delete" href="javascript:;" onclick="javascript:return confirmDelete('<?=$root?>/action.php?act=del_tinraovat&id=<?=$rv_id?>&u_id=<?=$rv_nguoidang?>');">Xóa</a>
					<? }else{ ?>
							<a class="link-alert" title="Báo cho quản trị về nội dung thông tin." href="<?=$root?>/gop-y/">Báo quản trị</a>&nbsp;               
					<? } ?>    
					</div>

					
					
					<br style="line-height:1px;font-size:0px;clear:both;" />
				</div>  
				
				<div id="panel-right">        
					
				<div id="seller-summary">
					
					<!-- SELLER INFOMATION -->
					<?
					
						$rs2 = $db->query("SELECT * FROM ".$prefix."nguoidung WHERE u_id = '".$rv_nguoidang."' AND u_banned = 1");	
						$row2 = $db->fetch_array($rs2);
						$u_id = $row2[u_id];
						$u_capdo = $row2[u_capdo];
						$u_name = stripslashes($row2[u_name]);
						$u_tenshop = stripslashes($row2[u_tenshop]);
						$u_avatar = $PathThumbFile . $row2[u_avatar];
						$u_tinhthanh = layTinhThanh($row2[u_tinhthanh]);
						$u_dienthoaicodinh = stripslashes($row2[u_dienthoaicodinh]);
						$u_dienthoaididong = stripslashes($row2[u_dienthoaididong]);
						$u_nickchat = loadNickChat(0,$row2[u_nickchat]);
						$u_chuky = $myString->unQuote(stripslashes($row2[u_chuky]));
						
					?>
					<div class="content">
						   <table width="100%" cellpadding="0" cellspacing="0" border="0">
								<tr>
									<td width="15%">
										<p style="padding-left:5px;">                     
											<a href="<?=$root?>/shop-<?=$u_id?>/<?=$u_name?>" title="<?=$u_name?>" >                   
												<img alt="<?=$u_name?>" width="60px" src="<?=$root?>/<?=$u_avatar?>" onerror="this.src='<?=$root?>/themes/images/noavatar.jpg';"/>
											</a>                    
										</p>
						
										<p style="padding-left:5px;">
											<a class="seller" title="<?=$u_name?>" href="<?=$root?>/shop-<?=$u_id?>/<?=$u_name?>"><?=tenNguoiDung($u_id);?></a>                 
										</p>
								  </td>
									<td width="85%" valign="top">
										<p>
											<span class="seller-fullname"><a href="<?=$root?>/shop-<?=$u_id?>/<?=$u_name?>"><?=$u_tenshop?></a></span>                              
										</p>  
										
										<p>
											<span class="seller-level1">Số sản phẩm : <?=loadSoSanPhamTheoUser($u_id)?></span>
							
										</p>
							 
										<p>
											<span><label>Khu vực</label>: <?=$u_tinhthanh?></span>
										</p>
								  </td>
								</tr>
						   </table>
					  
					</div>  
						<!-- SELLER INFOMATION -->

					<div class="clearBoth" style="border-top:solid 1px #CCCCCC;margin-bottom:5px;"></div>                   
					<div style="width:auto;margin-left:5px;margin-right:5px;">  
						<ul class="user-contactInfo">                                
							<li><span class="seller-phone" style="line-height:18px;">
						<? if($u_dienthoaicodinh != ""){ ?>	
							<img style="vertical-align: bottom;" src="<?=$root?>/themes/images/form/phone/desk-phone.jpg"> <?=$u_dienthoaicodinh?> - 
						<? } if($u_dienthoaididong != ""){ ?>
							<img style="vertical-align: bottom;" src="<?=$root?>/themes/images/form/phone/mobi-phone.jpg"> <?=$u_dienthoaididong?>
							<? } ?>
							</span></li>                            
						</ul>           
						<ul class="user-function">              
							<li><a href="<?=$root?>/shop-<?=$u_id?>/<?=$u_name?>"><img src="<?=$root?>/themes/images/thanhtoan.gif" alt="Thông tin thanh toán" /></a></li>             
							<li><span><a href="<?=$root?>/gui-tin-nhan/<?=$u_name?>">Gởi tin nhắn riêng</a></span></li>

							<li><span><a href="<?=$root?>/san-pham/<?=$u_id?>/<?=$u_name?>">Xem tất cả sản phẩm</a></span></li>
							
							
								<li><span><a href="<?=$root?>/ket-ban/<?=$u_id?>/<?=$u_name?>">Kết bạn</a></span></li>                
							
						  
						</ul> 
						<ul class="user-chat">
							<li><label style="float:none;">Nick Chat:</label> </li><li style="padding-left:5px;"><img style="vertical-align: middle;" src="http://mail.opi.yahoo.com/online?u=<?=$u_nickchat?>&m=g&t=5">  <a href="ymsgr:sendim?<?=$u_nickchat?>"><?=$u_nickchat?></a></li>
						</ul>  
					</div>

					<br style="line-height:1px;font-size:0px;" />
				</div>

				</div>
				
				<div class="clearBoth"></div>
			</div>
		</div>    


              
<div id="page-product-lpane2"> 
	<div id="product-detail">
		<div class="header">Mô tả chi tiết</div>
		<div class="product-detail-inner">
			<div class="product-detail-description">  
			  <?=$rv_chitiet?>

			   <div class="signature" style="border-top:dasded 1px #CCCCCC;margin-top:35px;">
					<p style="margin:0px;margin-top:5px;">
						<?=$u_chuky?>
					</p>
			   </div>      
			   
				<div style="text-align:right;">
					<a href="javascript:void(0)" style="font-style:normal;font-size:8pt;">
						<input alt="Up" title="Up sản phẩm" type="button" value="Up" style="height: 30px;width: 50px;background: #f6f7fc;border: 1px solid #d8dfea;margin-bottom: 10px;" />
					</a>
				</div>    
						  
			   <div class="date" style="margin-top:5px;font-style:normal;font-size:8pt;text-align:right;">
					<?
					if($_SESSION['is_login'] == true && $_SESSION['uid'] == $rv_nguoidang){
					?>
					<a class="link-edit" href="<?=$root?>/sua-tin-rao-vat/<?=$rv_id?>/<?=$myString->vietdecode($rv_tieude)?>">Cập nhật</a>
						|
						<a class="link-delete" href="javascript:;" onclick="javascript:return confirmDelete('<?=$root?>/action.php?act=del_tinraovat&id=<?=$rv_id?>&u_id=<?=$rv_nguoidang?>');">Xóa</a>
					<? }else{ ?>
							<a class="link-alert" title="Báo cho quản trị về nội dung thông tin." href="<?=$root?>/gop-y/">Báo quản trị</a>&nbsp;               
					<? } ?>
						
						
			   </div>                          
			</div>  
		</div>
	</div>
</div>           
        
</div>    
                  
</div>
    <div style="clear:both; margin-bottom: 10px;"></div>    
   
   <?
    file_exist('includes/raovat/inc_tincungnguoidang.php');
   	include('includes/raovat/inc_tincungnguoidang.php');
   ?>
   
    <!-- } Main Page-Content -->            
